package com.example.firstapp;

import android.os.Bundle;
import android.util.Log;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
//        EdgeToEdge.enable(this);
//        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
//            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
//            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
//            return insets;
//        });
//        // 创建一个LinearLayout对象
//        LinearLayout linearLayout = new LinearLayout(MainActivity.this);
//        // 设置 LinearLayout 的布局方向为垂直
//        linearLayout.setOrientation(LinearLayout.VERTICAL);
//        // 创建一个按钮对象
//        Button btn = new Button(MainActivity.this);
//        btn.setText("点击");
//        // 创建 LinearLayout.LayoutParams 对象并设置相应参数
//        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
//                LinearLayout.LayoutParams.MATCH_PARENT,
//                LinearLayout.LayoutParams.WRAP_CONTENT);
//        // 设置权重
//        layoutParams.weight = 1.0f;
//        // 将布局参数应用到按钮上
//        btn.setLayoutParams(layoutParams);
//        // 将按钮添加到 LinearLayout 中
//        linearLayout.addView(btn);
//        LinearLayout rootLayout = findViewById(R.id.abc);
//        // 将 LinearLayout 添加到活动的根布局中
//        rootLayout.addView(linearLayout);

        Log.d("===myLog===","onCreate: debug");
        Log.e("===myLog===","onCreate: error");
        Log.i("===myLog===","onCreate: info");
        Log.w("===myLog===","onCreate: warning");
        Log.v("===myLog===","onCreate: verbose");
    }
}